// /////////////////////////////////////////////////////////////////////////////
//
// Name:            LightComponent.h
// Author:          Michael Bartsch (ZCCdark203)
//
// Desc :           Declaration of the LightComponent class.
//
// License:         Copyright (C) 2009 Michael Bartsch and Contributors
//
//                  This program is free software: you can redistribute it
//                  and/or modify it under the terms of the zlib/libpng License.
//                  See main.cpp for conditions of distribution and use.
//
// /////////////////////////////////////////////////////////////////////////////

#ifndef __LIGHTCOMPONENT_H__
#define __LIGHTCOMPONENT_H__

// Include files
#include "../../dependencies.h"
#include "SceneComponent.h"


// LightComponent class
//! Component wrapper of Irrlicht's ILightSceneNode.
//!
//! <b>XML:</b>
//! \code
//! <LightComponent>
//!    <!-- Properties -->
//! </LightComponent>
//! \endcode
class LightComponent : public SceneComponent
{
public:

    // Initialisation and deinitialisation
    //! Constructor (default)
    //! @param parent        The parent entity to which the component should be added.
    //! @param color         Diffuse color of the light.
    //! @param radius        Radius of the light.
    LightComponent(Entity *parent, const SColorf &color = SColorf(1.0f, 1.0f, 1.0f),
                   f32 radius = 100.0f);
    //! Deconstructor
    ~LightComponent();

    // Methods
    //! Returns a direct pointer to the ILightSceneNode.
    ILightSceneNode* getLightSceneNode();

    //! Returns whether this light casts shadows.
    bool getCastShadow() const;
    //! Gets the light type.
    E_LIGHT_TYPE getLightType() const;
    //! Gets the light's radius of influence.
    f32 getRadius() const;

    //! Sets whether this light casts shadows.
    //!
    //! <b>XML:</b>
    //! \code
    //! <castShadow type="bool" value="" />
    //! \endcode
    //!
    //! @param shadow        Value to enable or disable this option.
    void setCastShadow(bool shadow = true);
    //! Sets the light type.
    //!
    //! <b>XML:</b>
    //! \code
    //! <lightType type="string" value="" />
    //! \endcode
    //!
    //! @param type          The light type (see: Irrlicht API documentation)
    void setLightType(E_LIGHT_TYPE type);
    //! Sets the light's radius of influence.
    //!
    //! <b>XML:</b>
    //! \code
    //! <radius type="number" value="" />
    //! \endcode
    //!
    //! @param radius        The new radius.
    void setRadius(f32 radius);

    // Serialization
    //! Serializes this object.
    //! @param attributes
    virtual bool onSerialization(SerializedAttributes *attributes);
    //! Deserializes this object.
    //! @param attributes
    virtual bool onDeserialization(SerializedAttributes *attributes);

private:

    // Members
    ILightSceneNode *mLightSN;
};

#endif
